#include <string>
#include <iostream>
#include <sstream>
using namespace std;

class Fan
{
public:
    Fan();
    Fan(unsigned long c, double r, int vel=SLOW);

    unsigned long getColor() const;
    void setColor(unsigned long c= 0xFFFFFF);

    bool isOn() const;
    void turnOn();
    void turnOff();

    double getRadius() const;

    int getSpeed() const;
    void setSpeed(int speed=SLOW);

    string status()const;
    static const int SLOW;
    static const int MEDIUM;
    static const int FAST;
private:
    int speed;
    bool on;
    unsigned long color;
    const double radius;
};

const int Fan::SLOW = 1;
const int Fan::MEDIUM = 2;
const int Fan::FAST = 3;

Fan::Fan() : radius(5.0)
{
    speed = SLOW;
    on = false;
    color = 0xFFFFFF;
}

Fan::Fan(unsigned long c, double r, int vel) : color(c), radius(r), speed(vel)
{
}

unsigned long Fan::getColor() const
{
    return color;
}

void Fan::setColor(const unsigned long c)
{
    color = c;
}

bool Fan::isOn() const
{
    return on;
}

void Fan::turnOn()
{
    on = true;
}

void Fan::turnOff()
{
    on = false;
}

double Fan::getRadius() const
{
    return radius;
}

int Fan::getSpeed() const
{
    return speed;
}

void Fan::setSpeed(int vel)
{
    speed = vel;
}

string Fan::status()const
{
    ostringstream os;

    if(isOn())
    {
        os << "Fan status: ";
        switch (speed)
        {
        case SLOW:
            os << "SLOW ";
            break;
        case MEDIUM:
            os << "MEDIUM ";
            break;
        case FAST:
            os << "FAST ";
            break;
        }
    }
    else
        os << "Fan is OFF: ";

    switch (color)
    {
    case 0xFFFFFF:
        os << "WHITE ";
        break;
    case 0xFF0000:
        os << "RED ";
        break;
    case 0x00FF00:
        os << "GREEN ";
        break;
    case 0x0000FF:
        os << "BLUE ";
        break;
    }

    os << radius;

    return os.str();
}

int main()
{
    Fan fan1;
    cout << "Fan 1:" << endl;
    cout << fan1.status() << endl;
    fan1.turnOn();
    fan1.setSpeed(Fan::FAST);
    cout << fan1.status() << endl;

    Fan fan2(0x0000FF, 8);
    cout << "Fan 2:" << endl;
    cout << fan2.status() << endl;
    fan2.turnOn();
    cout << fan2.status() << endl;

    Fan fan3(0xFF0000, 3);
    cout << "Fan 3:" << endl;
    cout << fan3.status() << endl;
    fan3.turnOn();
    fan3.setColor(0x00FF00);
    cout << fan3.status() << endl;
    fan3.turnOff();
    cout << fan3.status() << endl;

    return 0;
}




